package com.javarush.test.level03.lesson08;

import java.io.File;

/**
 * Created by IntelliJ IDEA.
 * User: Andry
 * Date: 28.01.13
 * Time: 23:10
 * To change this template use File | Settings | File Templates.
 */
public class completed3L
{
    public static void birthday(int day, String month, int year)
    {
        System.out.println(month + " " + day + " " + year);
    }

    public static void myName(String name)
    {
        for (int i = 0; i < 5; i++)
        {
            System.out.println();
            int j = 0;
            while(j < 10)
            {
                System.out.print(name + " ");
                j++;
            }
        }
    }

    public void mammyWashMyLexus()
    {
        String s1, s2, s3;
        s1 = "Мама";
        s2 = "Мыла";
        s3 = "Раму";
        System.out.println(s1 + s2 + s3);
        System.out.println(s1 + s3 + s2);
        System.out.println(s2 + s1 + s3);
        System.out.println(s2 + s3 + s1);
        System.out.println(s3 + s2 + s1);
        System.out.println(s3 + s1 + s2);
    }

    public void multiplicationTable()
    {
        int tm[][] = new int[10][10];
        int z = 1;
        for (int i = 0; i < 10; i++)
        {
            if (i == 0)
            {
                for (int j = 0; j < 10; j++)
                {
                    tm[i][j] = j + 1;
                }
            }
            else
            {
                for (int j = 0; j < 10; j++)
                {
                    if (j == (z - 1))
                    {
                        tm[i][j] = i + 1;
                    }
                    else
                    {
                        int x, y;
                        x = tm[0][j];
                        y = tm[i][0];
                        tm[i][j] = x * y;
                    }
                }
            }
        }

        int f;
        for (int i = 0; i < 10; i++)
        {
            for (int j = 0; j < 10; j++)
            {
                f = tm[j][i];
                System.out.print(f + "  ");
            }
            System.out.println();
        }
    }

    public void rainbowColors()
    {
        String rainbow[] = {"красный", "оранжевый", "желтый", "зеленый", "голубой", "синий" , "фиолетовый"};

        for (int i = 0; i < 7; i++)
        {
            if ((((i + 1) % 3) == ((i + 1) / 3)) || (((i + 1) % 6) == ((i + 1) / 6)))
            {
                System.out.println();
            }
            System.out.print(rainbow[i] + " ");
        }
    }

    public void openJavaExe()
    {
        File jfile = new File("C:\\Program Files\\Java\\jre6\\bin\\java.exe");
        System.out.println(jfile.getAbsolutePath());
    }
}
